package sctu.edu.java.year2016.team05.lizixin.day20160615.LianXi1;

import javax.swing.*;
import java.awt.*;

/**
 * Created by home on 2016/6/15.
 * 13.1窗体
 */
public class Example1 extends JFrame {
    public void CreateJFrame(String title) {
        JFrame jf = new JFrame(title);

        Container container = jf.getContentPane();
        JLabel ji = new JLabel("这是一个JFrame窗体");
        ji.setHorizontalAlignment(SwingConstants.CENTER);
        container.add(ji);
        container.setBackground(Color.white);
        jf.setVisible(true);
        jf.setSize(200, 150);
        jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new Example1().CreateJFrame("创建一个JFrame窗体");
    }

}
